﻿using Microsoft.Practices.EnterpriseLibrary.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XXVIII.DAL.IDAL;
using XXVIII.DAL.SqlServerDAL;
using XXVIII.Entity;

namespace XXVIII.DAL.SqlServerDAL
{
    public class FormDAL : IFormDAL
    {

        public bool Add(string tableName, Dictionary<string, string> keyValue)
        {
            return SqlServerHelper.Instance.Add(tableName, keyValue);
        }

        public DataTable Get(string tableName, List<TableAndOrLikeEntity> andOrLikeList)
        {
            return SqlServerHelper.Instance.Get(tableName, andOrLikeList);
        }

        public bool Update(string tableName, Dictionary<string, string> keyValue, List<TableAndOrLikeEntity> andOrLikeList)
        {
            return SqlServerHelper.Instance.Update(tableName, keyValue, andOrLikeList);
        }

        public bool CreateSignTable(string tableName, List<CreateCloumnEntity> columns)
        {
            return SqlServerHelper.Instance.CreateSignTable(tableName, columns);
        }

        public bool CheckTableExist(string tableName)
        {
            return SqlServerHelper.Instance.CheckTableExist(tableName);
        }

        public bool DropSignTable(string tableName)
        {
            return SqlServerHelper.Instance.DropSignTable(tableName);
        }

        public bool Delete(string tableName, List<TableAndOrLikeEntity> andOrLikeList)
        {
            return SqlServerHelper.Instance.Delete(tableName, andOrLikeList);
        }

        public DataTable GetByPage(string tableName, List<TableAndOrLikeEntity> andOrLikeList, ref DBPageBase page)
        {
            return SqlServerHelper.Instance.GetByPage(tableName, andOrLikeList, ref page);
        }

        public DataTable Get(string sql)
        {
            return SqlServerHelper.Instance.Get(sql);
        }

        public bool ExecuteSql(string sql)
        {
            return SqlServerHelper.Instance.ExecuteSql(sql);
        }

        public List<TablePropertyEntity> GetTableProperty(string tableName)
        {
            return SqlServerHelper.Instance.GetTableProperty(tableName);
        }

        public void RecordToTable(string tableName, string customJson, bool isJoin = false)
        {
            SqlServerHelper.Instance.RecordToTable(tableName, customJson, isJoin);
        }
        public void UnRecordToTable(string tableName)
        {
            SqlServerHelper.Instance.UnRecordToTable(tableName);
        }

    }
}
